<?php

/**

 * 验证码

 * * @网店运维 (c) 2015-2018 ShopWWI Inc. (http://www.shopwwi.com)

 * @license    http://www.shopwwi.c om

 * @link       交流群号：111731672

 * @since      网店运维提供技术支持 授权请购买shopnc授权

 */







defined('ByShopWWI') or exit('Access Invalid!');



class seccodeControl{

    public function __construct(){
$sj= Model('store')->getStoreInfoByID($_SESSION['chain_store_id']);
		$model_member = Model('member');
        $member_info = $model_member->getMemberInfo(array('member_id'=>$sj['member_id']));
		
	        Tpl::output('member_info',$member_info);
    }



    /**

     * 产生验证码

     *

     */

    public function makecodeOp(){

        $refererhost = parse_url($_SERVER['HTTP_REFERER']);

        $refererhost['host'] .= !empty($refererhost['port']) ? (':'.$refererhost['port']) : '';



        $seccode = makeSeccode($_GET['nchash']);



        @header("Expires: -1");

        @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);

        @header("Pragma: no-cache");



         	$code = new seccode();

		$code->code = $seccode;

		$code->width = 90;

		$code->height = 26;

		$code->background = 1;

		$code->adulterate = 1;

		$code->scatter = '';

		$code->color = 1;

		$code->size = 0;

		$code->shadow = 1;

		$code->animator = 0;

		$code->datapath =  BASE_DATA_PATH.'/resource/seccode/';

		$code->display();

   

    }



    /**

     * AJAX验证

     *

     */

    public function checkOp(){

        if (checkSeccode($_GET['nchash'],$_GET['captcha'])){

            exit('true');

        }else{

            exit('false');

        }

    }

}

